<!DOCTYPE html>
<html>
<head>
    <title>授权模板管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../../resources/lib/bui/css/bui-min.css" rel="stylesheet">
    <link href="../../resources/lib/bui/css/dpl-min.css" rel="stylesheet">
</head>
<body>
<div style="padding: 10px">
    <div>
        <button type="button" class="button button-primary" onclick="addTemplet()">添加模板</button>
        <button type="button" class="button button-primary" onclick="removeTemplet()">删除</button>
    </div>
    <div class="row">
        <div class="span4" style="padding-top: 10px;">
            <div class="panel panel-head-borded panel-small">
                <div class="panel-header">模板列表</div>
                <div id="list1">
                </div>
            </div>
        </div>
        <div class="span16">
            <div class="panel panel-head-borded panel-small">
                <form name="templetForm" method="" action="" id="templetForm" class="form-horizontal">
                    <legend>基本信息</legend>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>名称：</label>
                            <div class="controls">
                                <input name="Name" type="text" class="control-text"data-rules="{required:true}">
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>认证方式：</label>
                            <div class="controls">
                                <select name="Identify" class="input-normal">
                                    <option value="1">卡认证</option>
                                    <option value="2">密码认证</option>
                                    <option value="3">卡+密码认证</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>人组：</label>
                            <div class="controls">
                                <select name="memberGroup" class="input-normal">
                                    <option value="1">人组1</option>
                                    <option value="2">人组2</option>
                                    <option value="3">人组3</option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label">证章模板：</label>
                            <div class="controls">
                                <select name="badgeTemplate" class="input-normal">
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>人组：</label>
                            <div class="controls">
                                <select name="action" class="input-normal">
                                    <option value="1">尾随</option>
                                    <option value="2">报警</option>
                                    <option value="3">禁用</option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label">描述：</label>
                            <div class="controls">
                                <input name="description" type="text" class="control-text">
                            </div>
                        </div>
                    </div>
                    <legend>卡信息</legend>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>卡号：</label>
                            <div class="controls">
                                <input name="cardId" type="text" class="control-text"data-rules="{required:true}">
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>卡类型：</label>
                            <div class="controls">
                                <select name="type" class="input-normal">
                                    <option value="1">身份证</option>
                                    <option value="2">IP卡</option>
                                    <option value="3">CPU卡</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>卡等级：</label>
                            <div class="controls">
                                <input name="authority" type="text" class="control-text"data-rules="{required:true}">
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label">卡附加信息：</label>
                            <div class="controls">
                                <select name="comment" class="input-normal">
                                    <option value="1">丢失</option>
                                    <option value="2">损坏</option>
                                    <option value="3">被盗</option>
                                </select>
                                </select>
                            </div>
                        </div>
                    </div>
                    <legend>密码信息</legend>
                    <div class="row">
                    <div class="control-group span8">
                        <label class="control-label"><s>*</s>pin码长度：</label>
                        <div class="controls">
                            <input name="pinCodeLen" type="text" class="control-text"data-rules="{required:true}">
                        </div>
                    </div>
                    <div class="control-group span8">
                        <label class="control-label"><s>*</s>胁迫码长度：</label>
                        <div class="controls">
                            <input name="duressCodeLen" type="text" class="control-text"data-rules="{required:true}">
                        </div>
                    </div>
                </div>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>胁迫等级：</label>
                            <div class="controls">
                                <input name="duressAuthority" type="text" class="control-text"data-rules="{required:true}">
                            </div>
                        </div>
                    </div>
                    <legend>规则信息</legend>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label">时间规则特权：</label>
                            <div class="controls">
                                <input name="timeRule" type="checkbox" >
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label">多人规则特权：</label>
                            <div class="controls">
                                   <input name="abRule" type="checkbox" >
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>潜回特权：</label>
                            <div class="controls">
                                <input name="lineRule" type="checkbox" >
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label">允许通过区域：</label>
                            <div class="controls">
                                <select name="areas" class="input-normal">
                                    <option value="1">区域1</option>
                                    <option value="2">区域2</option>
                                    <option value="3">区域3</option>
                                </select>
                                </select>
                            </div>
                        </div>
                    </div>
                    <legend>时间信息</legend>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>生效时间：</label>
                            <div class="controls">
                                <input name="activeStart" type="text" class="calendar" data-rules="{required:true}">
                            </div>
                        </div>
                        <div class="control-group span8">
                            <label class="control-label"><s>*</s>失效时间：</label>
                            <div class="controls">
                                <input name="activeEnd" type="text" class="calendar" data-rules="{required:true}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="control-group span8">
                            <label class="control-label">延长开门时间(秒)：</label>
                            <div class="controls">
                                <input name="accessTimeExtension" type="text" class="control-text">
                            </div>
                        </div>
                    </div>
                    <div class="row form-actions actions-bar">
                        <div class="span13 offset3 ">
                            <button type="submit" class="button button-primary">保存</button>
                            <button type="reset" class="button">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="../../resources/lib/bui/js/jquery-1.8.1.min.js"></script>
    <script src="../../resources/lib/bui/js/bui-min.js"></script>
    <!-- script start-->
    <script type="text/javascript">
        BUI.use(['bui/list'],function(List){
            var items = [
                        { text: '授权模板1', cardId:"111",type:"身份证",authority:"5",comment:"丢失",Identify:"卡认证",pinCodeLen:"5",duressCodeLen:"5",duressAuthority:"20",memberGroup:"人组1",activeStart:"2013-8-13 16:35:00",activeEnd:"2013-12-13 00:00:00",action:"尾随",areas:"区域1",description:"啦啦"},
                        { text: '授权模板2', cardId:"222",type:"IP卡",authority:"4",comment:"损坏",Identify:"密码认证",pinCodeLen:"6",duressCodeLen:"6",duressAuthority:"30",memberGroup:"人组2",activeStart:"2013-6-14 12:20:00",activeEnd:"2014-2-9 00:00:00",action:"报警",areas:"区域2",description:"嗯嗯"},
                        { text: '授权模板3', cardId:"333",type:"CPU卡",authority:"3",comment:"被盗",Identify:"卡+密码认证",pinCodeLen:"3",duressCodeLen:"3",duressAuthority:"10",memberGroup:"人组3",activeStart:"2013-5-13 13:40:00",activeEnd:"2013-9-26 00:00:00",action:"禁用",areas:"区域3",description:"无"}
                    ],
                    list = new List.SimpleList({
                        elCls:'bui-select-list',//默认是'bui-simple-list'
                        width:148,
                        height:700,
                        render : '#list1',
                        items : items
                    });
            list.render();
            list.on('itemclick', function(){
                $("#templetForm input[name=Name]").val(list.getSelectedText());
            });
        });


        var form = new Form.Form({
            srcNode : '#templetForm'
        });
        form.render();

        form.on('beforesubmit',function(){
            if(!editing.isValid()){
                return false;
            }
        });
        function addTemplet() {
            /*$("#dcForm").hide();
             $("#doorForm").hide();*/
            $("#templetForm input[type=reset]").click();
            $("#templetForm input[name='Name']").val("新建模板");
            //var node = tree.getSelected();
            $("#templetForm input[name=id]").val(null);// 删除id属性
        }
    </script>
    <script type="text/javascript">
        BUI.use('bui/calendar',function(Calendar){
            var datepicker = new Calendar.DatePicker({
                trigger:'.calendar',
                autoRender : true
            });
        });
    </script>
    <!-- script end -->
</div>
</body>
</html>